home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 60.zip
/
BS1 part 60
/
Highspeed pascal.adf
/
HSPascal
/
AmigaDemos
/
MouseDemo.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-12-31
|
3KB
|
84 lines
{--------------------------------------------------------------------------
HighSpeed Pascal for the Amiga
MOUSE TRACKING DEMO
Programmed by Martin Eskildsen 1991
Copyright (c) 1991 by D-House I ApS
All rights reserved
Version : Date (dd.mm.yy) : Comment
-----------------------------------
1.00 : 22.07.91 : First version
1.01 : 13.08.91 : Uses Init.LegalPosition
1.02 : 17.09.91 : Uses new libraries
1.03 : 06.11.91 : Final for first release
--------------------------------------------------------------------------}
program MouseDemo;
uses Init, Intuition, Exec, Graphics;
procedure DrawLoop;
var
dummy : integer;
Imessage : pIntuiMessage; { The messages sent to this program }
class : integer; { Message class }
code : integer; { Message code }
quit : boolean; { TRUE = done showing menu }
drawing : boolean; { TRUE = we are drawing }
x, y : integer; { Mouse (x,y) }
begin
quit := FALSE; { Not done yet }
drawing := FALSE; { Not drawing at entry }
Move_(OutputWindow^.RPort, 2,10); { Move to upper left of work area }
repeat
dummy := Wait(BitMask(OutputWindow^.UserPort^.MP_SIGBIT));
{ Wait for something to happen }
Imessage := pIntuiMessage(GetMsg(OutputWindow^.UserPort));
{ Find out what }
while Imessage <> NIL do begin
class := Imessage^.class; { Save for later use }
code := Imessage^.code;
x := Imessage^.MouseX;
y := Imessage^.MouseY;
ReplyMsg(pMessage(Imessage)); { Accept this message }
case class of
MOUSEBUTTONS : begin
drawing := code = SELECTDOWN;
if drawing and LegalPosition(x, y) then
Move_(OutputWindow^.RPort, x, y)
end;
MOUSEMOVE : if drawing and LegalPosition(x, y) then
Draw(OutputWindow^.RPort, x, y);
CLOSEWINDOW_ : quit := TRUE
end;
Imessage := pIntuiMessage(GetMsg(OutputWindow^.UserPort)) { Get next }
end;
until quit
end;
begin
if PrepareEnvironment('Mouse Tracking') then begin
Message('First, a window to draw in');
with OutputWinDef do begin { Tell Intuition that we want }
IDCMPflags := IDCMPflags or MOUSEBUTTONS or MOUSEMOVE;
Flags := Flags or REPORTMOUSE_
end;
OpenOutputWindow;
Inform('Ready! Press left mouse button to draw; Close gadget to end');
DrawLoop;
CloseOutputWindow;
CloseDown
end
end.